﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
 
using System.Text;
using System.Windows.Forms;

namespace Demo
{
    public partial class SpreadSkins : DemoBaseUserControl
    {
        public SpreadSkins()
        {
            InitializeComponent();
            this.Title = "Spread 皮肤";
            this.Description = "Spread .NET  提供了丰富的皮肤类型。您可以从列表中选择皮肤或者点击自定义皮肤按钮在弹出的编辑器中创建自定义皮肤。";
        }

        private void SpreadSkins_Load(object sender, EventArgs e)
        {
            FpSpread1.DataSource = 销售明细表TableAdapter.GetData();
            this.ListBox1.Items.Add(FarPoint.Win.Spread.DefaultSpreadSkins.Default);
            this.ListBox1.Items.Add(FarPoint.Win.Spread.DefaultSpreadSkins.Classic);
            this.ListBox1.Items.Add(FarPoint.Win.Spread.DefaultSpreadSkins.ArcticSea);
            this.ListBox1.Items.Add(FarPoint.Win.Spread.DefaultSpreadSkins.Newspaper);
            this.ListBox1.Items.Add(FarPoint.Win.Spread.DefaultSpreadSkins.Rose);
            this.ListBox1.Items.Add(FarPoint.Win.Spread.DefaultSpreadSkins.Sandstorm);
            this.ListBox1.Items.Add(FarPoint.Win.Spread.DefaultSpreadSkins.Shamrock);
            this.ListBox1.Items.Add(FarPoint.Win.Spread.DefaultSpreadSkins.Sunburst);
            this.ListBox1.SelectedIndex = 0;
        }

        private void Button1_Click(object sender, EventArgs e)
        {

            FarPoint.Win.Spread.SpreadSkinsForm sf = new FarPoint.Win.Spread.SpreadSkinsForm(FpSpread1);
            TabControl tc;
            tc = (TabControl)sf.Controls["panel2"].Controls["tabControl1"];
            tc.SelectedIndex = 2;
            sf.ShowDialog(this);
        }

        private void ListBox1_SelectedIndexChanged(object sender, EventArgs e)
        {
            switch (ListBox1.SelectedIndex)
            {
                case 0:
                    FarPoint.Win.Spread.DefaultSpreadSkins.Default.Apply(FpSpread1);
                    break;
                case 1:
                    FarPoint.Win.Spread.DefaultSpreadSkins.Classic.Apply(FpSpread1);
                    break;
                case 2:
                    FarPoint.Win.Spread.DefaultSpreadSkins.ArcticSea.Apply(FpSpread1);
                    break;
                case 3:
                    FarPoint.Win.Spread.DefaultSpreadSkins.Newspaper.Apply(FpSpread1);
                    break;
                case 4:
                    FarPoint.Win.Spread.DefaultSpreadSkins.Rose.Apply(FpSpread1);
                    break;
                case 5:
                    FarPoint.Win.Spread.DefaultSpreadSkins.Sandstorm.Apply(FpSpread1);
                    break;
                case 6:
                    FarPoint.Win.Spread.DefaultSpreadSkins.Shamrock.Apply(FpSpread1);
                    break;
                case 7:
                    FarPoint.Win.Spread.DefaultSpreadSkins.Sunburst.Apply(FpSpread1);
                    break;
            }


        }
    }
}
